<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/** 
 *  Home Class  
 *  
 * @package XGO CMS v2.0 
 * @subpackage News  
 * @author TyTran - 30/07/2012 
 * @link http://sunsoft.vn
 */
class Library extends CI_Controller{
	
	/** 
	 * Contrust class
	 *  
	 * @access public 
	 */
	 
	public function __construct(){
		parent::__construct();
		$this->load->library('smarty3', '', 'smarty');
		
		require_once(APPPATH.'modules/frontend/home/menu.php');
		require_once(APPPATH.'modules/frontend/home/support.php');
		require_once(APPPATH.'modules/frontend/news/paging.php');
		require_once(APPPATH.'modules/frontend/home/advertising.php');
	}  
	
	public function index(){

		$type = $this->uri->rsegment(3);
		//echo $type; exit;
		//$type =  explode(".", $type);
		
		//if($type[1] != 'html'){
			//redirect('home');
		//}
		
		if(!empty($type)){
			if($type == 'hinh-nen'){
				$data = new Data_model();
				$data->where('type','background');  
				$data->get();
				
				$this->smarty->assign('data', $data);
				$this->smarty->assign('type', 'background');
			}
			else{
				if($type == 'thanh-vien'){
					$data = new Data_model();
					$data->where('type','member');  
					$data->get();
					
					$this->smarty->assign('data', $data);
					$this->smarty->assign('type', 'member');
				}
				else{
					if($type == 'phim-anh'){
					$data = new Data_model();
					$data->where('type','movie');  
					$data->get();
					
					$this->smarty->assign('data', $data);
						$this->smarty->assign('type', 'movie');
					}
					else{
						redirect('home');	
					}
				}
			}
			$this->smarty->view('frontend/news/library', 'library');
			$this->smarty->view('frontend/news/left_news', 'left_news');
			$this->smarty->view('frontend/news/news_view', 'news_view');
			$this->smarty->display('template/frontend/home');
		}
		else{	
			redirect('home');
		}
	}

}
/* End of file admin/cpanel.php */
/* Location: ./system/application/controllers/admin/cpanel.php */